#include "StdAfx.h"
#include "MemberManager.h"

CMemberManager::CMemberManager(void)
{
	m_islinked = FALSE;
}

CMemberManager::~CMemberManager(void)
{
}

BOOL CMemberManager::ConnectDB(MYSQLSERVERINFO *mysqlserverinfo)
{
	m_MemberSql = new CMemberSql();	
	if(m_MemberSql->ConnectDB(mysqlserverinfo))
	{
		m_islinked = TRUE;
		return TRUE;
	}
	else
	{
		m_islinked = FALSE;
		return FALSE;
	}
}
BOOL CMemberManager::CloseDB()
{
	return m_MemberSql->CloseDB();
}
BOOL CMemberManager::MemberExist(Member* mem)
{
	return m_MemberSql->IsExist(mem);
}
void CMemberManager::AddLinkUser(Member* user)
{

}
void CMemberManager::DeleteMember(Member* mem)
{
	m_MemberSql->DeleteMember(mem);
}
void CMemberManager::AddMember(Member* mem)
{
	m_MemberSql->InsertMember(mem);
}
void CMemberManager::EditMember(Member* oldmem,Member* newmem)
{
	m_MemberSql->DeleteMember(oldmem);
	m_MemberSql->InsertMember(newmem);
}
std::vector<Member>* CMemberManager::GetAllMembers()
{
	return m_MemberSql->GetMembers();
}

BOOL CMemberManager::IsLinked()
{
	return m_islinked;
}


BOOL CMemberManager::IsValid(Member * mem)
{
	return m_MemberSql->IsValid(mem);
}
